;; 20251012: Error

;; package by shuguang79(ShuguangSun)
(use-package ess-view-data
  :defer t
  :after ess-site
  :init
  (setq ess-view-data-current-backend 'data.table+magrittr
        ess-view-data-current-update-print-backend 'kable)
  :bind
  ;; TODO ess-vied-data-select
  (("C-c C-v" . 'ess-view-data-print)
   (:map ess-view-data-mode-map
         ("q" . 'kill-current-buffer))))

;; --------

;; 20251012: R error during background ESS command ‘ls(.GlobalEnv)[c(sapply(ls(.GlobalEnv), function(x) {is.list(eval(parse(text = x)))}))]’
;; Error: 类别为’list’的下标无效

;; insert variable (column) names or values in ESS-R
(use-package ess-r-insert-obj
  :defer t
  :after ess-site
  :bind
  (("C-," . 'hydra-ess-r-insert-obj/body))
  :config
  (defhydra hydra-ess-r-insert-obj ()
    ("d" ess-r-insert-obj-dt-name "數據表名稱" :column "data.frame")
    ("c" ess-r-insert-obj-col-name "變量名" :column "column")
    ("C" ess-r-insert-obj-col-name-all "所有變量")
    ("v" ess-r-insert-obj-value "變量值" :column "value")
    ("V" ess-r-insert-obj-value-all "所有變量值")))
